﻿Imports System.Data.SqlClient
Imports System.Data

Partial Class ViewPackage
    Inherits System.Web.UI.Page

    Protected Sub DropDownList1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        If DropDownList1.SelectedItem.Text = "MailID" Then
            Label2.Visible = True
            TBSearch.Visible = True
            Label3.Visible = False
            TBDateEdit.Visible = False
        ElseIf DropDownList1.SelectedItem.Text = "Date Created" Then
            Label3.Visible = True
            TBDateEdit.Visible = True
            Label2.Visible = False
            TBSearch.Visible = False
        End If
    End Sub

    Protected Sub SqlDataSource1_Selecting(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting
       



    End Sub

    Protected Sub TBSearch_TextChanged(sender As Object, e As System.EventArgs) Handles TBSearch.TextChanged
        Dim ds As New DataSet
        Dim connectionString As String = ConfigurationManager.ConnectionStrings("MailSystemConnectionString2").ConnectionString
        Try
            Dim conn As New SqlConnection(connectionString)
            Dim sql As String = "SELECT [ID], [ParcelType], [Fragile], [Price], [Sender], [Reciver], [Destination], [Global], [CurrentLocation], [Status] FROM [vPackageLocation] WHERE ID = " + TBSearch.Text
            Dim adpt As New SqlDataAdapter(sql, conn)
            adpt.Fill(ds)
            GridView1.DataSource = ds
            GridView1.DataBind()
            GridView1.Visible = True

        Catch ex As Exception

        End Try

      
    End Sub
End Class
